#include <iostream>

using namespace std;


int main()
{
    int n = 0, num = 0;
    int a, b, c, d;
    while (scanf("%d", &num) != EOF)
    {
        d = num % 10;
        c = num / 10 % 10;
        b = num / 100 % 10;
        a = num / 1000;
        if (a == c && d == b + 1)
            n++;
    }
    cout << n << endl;
    return 0;
}